﻿using Microsoft.AspNetCore.Mvc;
using System;
namespace WebAPIDemo.Controllers
{
    [ApiController]
    [Route("[controller]")]
    public class PaddleOCRController : ControllerBase
    {
        [HttpPost("DetectText")]
        public string DetectText([FromBody]string base64)
        {
            var result = PaddleOCRHelper.Instance.DetectTextBase64(base64);
            Console.WriteLine(result.Text);
            return result.Text;
        }
         
        [HttpGet]
        public string Get()
        {
            string base64 = "iVBORw0KGgoAAAANSUhEUgAAAMMAAAAkCAYAAAA0Po6QAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAtzSURBVHhe7Zz/T1PnHsf5N/qzS5YlM0tmliW72dL9MHITl2xBF53jdndMYmTOze3eTiJTN3ajG7tlmdm9KvdAEbQqlnvwoqxgAUFEoHxZO77UWnC1XyiW2q4WUFre9znnPJXSr6eoLJrnlZxoT0+fPj2838/nyzltHh4HCx54LINwCNv4dfj9IUTpU6m5B/+FL9DEj+M+3fPomUdoygKXO0Qf50h4BsFwhD5gPI08HjMwGE8gzAwMBoWZgcGgMDMwGBRmBgaDwszAYFCYGRgMCjMDg0FhZmAwKMwMDAaFmYHBoDAzMBiUR2CGu/ANXIZrdoE+fggiIYTc1+EcaMOv3WaEFpfoE3KJ4n7QBe9QE/rOtMATeBS3/ZExw+EsNxoyngYegRnm4NFtBbdbC2+uihHubh34GUO6Chi+2oL6Tc+AK1iPevVedOqa4PQv0gMzEOrGJdXrOLP7TejU29F0uBxdR4pRX/AMqg/wCOTqJywhGvYh6J0S5zbIlZB5vQDdt//FzELOgzGeIFZlhiX/r7gx7oV0Q7Mf9iNvoEbTgXmyJzxUiYaSHTBeHEXmWLGEyKwZE208fuGKUau5iFn/GEbK/oyWbi89Rg7zmDn3F2iP9iFmnaVJLc5s/hTmaTmRQRC/BzOWToyeP4Wh3gkErGfQuv8TGDgtzL3N6FFvQPX+c/DnHKkSmYeVewd5eXkJmwL53Hhc9LkHt+kE1EoFfT4fam0f3OIBU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CRHelper.Instance.DetectTextBase64(base64);
            Console.WriteLine(result.Text);
            return result.Text;
        }
    }
}
